Chris Pollett > Old Classes > CS216
( Print View )

Student Corner:
  [Grades Sec1]

  [Submit Sec1]

  [Class Sign Up Sec1]

  [
Lecture Notes]
  [Discussion Board]

Course Info:
  [Texts & Links]
  [Topics/Outcomes]
  [Outcomes Matrix]
  [Grading]
  [HW/Quiz Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Additional Policies]
  [Announcements]

HWs and Quizzes:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Quizzes]  [Project]

Practice Exams:
  [Mid]  [Final]

                           












HW#2 --- last modified February 17 2019 19:46:04..

Solution set.

Due date: Mar 9

Files to be submitted:
  Hw1.zip

Purpose: To become familiar with Bézier Patches, Rational Bézier curves, Catmull-Rom and Bessel-Overhauser Splines.

Related Course Learning Outcomes:

The main course outcomes covered by this assignment are:

(1) Implement splines
(4) Implement different methods of surface subdivision
(5) Implement different methods of representing surfaces

Specification:

For this homework, I would like you to write a GLUT and OpenGL based program which reads points from a file specifying a spline curve and an angle, and then computes the corresponding Bézier Patches and displays them. The filename should be specified in a constant FILE_NAME plainly visible in the main file of your program. You should have a readme.txt file which spells out how I should set up your project (please make sure your project has avoids OS specific code). You should also include some sample files in the format described below. In particular, it should be make clear which is the main file of your program. The format of files your system should be able to read should contain any files with text of the following form:

X:angle_in_radians:num_points
point_1
point_2
...

X here represents one of R, C, or B which correspond to the curve types rational Bézier Curve, Catmull-Rom spline, or Bessel Overhauser spline. angle_in_radians should be a floating point literal between 0.0 and 2π representing how much you should rotate your spline around the y-axis. num_points should be an non-negative integer literal representing the number of points to read out of your file. point_1 is a comma separated list of floating points coordinates (non line-break white space ignored). For Rational Bézier curves there should be three coordinates for x, y, and w; for Catmull Rom curves just use two coordinates for an x and y value, for Bessel-Overhauser use three coordinates u, x, y where u is a knot value. For Catmull-Rom splines and Bessel-Overhauser splines the file might contain many points, so you might need to compute more than one Bézier Patch before drawing and then draw each of them. Except for the 0 and last control point in these cases you should get at least one Bézier patch for each pair of control points. For any of the curve types it will probably take more than one Bézier patch to do the rotation. For Rational Bézier curves you could get away with one patch if the rotation was 180 degrees. For angles other than this, the simplest, brute-force solution is to use recursive subdivision. For instance, for an angle of 135 degrees, you could imagine splitting the 180 degree patch into two 90 degree patches and then split the second 90 degree patch and toss away half. Stop the recursive subdivision when you have binary searched for an angle that reasonably closely approximates the target angle. This doesn't exactly work since a rational Bézier curve might not be traced out at constant speed. Nevertheless, for a rational Bézier curve you can evaluate it say at q(1/2) and see how much of the the semi-circle you have traced and still use this to essentially binary search for your target angle. You may use the built-in OpenGL functions discussed in class for drawing Bézier patches; however, your code is not allowed to use these functions to draw any patch of degree higher than three. Finally, in addition to drawing the surface itself, I would like you to plot the control points of your patches and a wire-frame between these points. Note for Catmull-Rom and Bessel-Overhauser, you compute the p^+ and p^- control points from those given in the file, but these will be used to make control points of your patches so should be plotted.

Bonus Point: You create a file format for and write code to draw extrusions of the three spline curves of this homework.

Point Breakdown

Departmental Coding Guidelines followed (fractional points as per Hw1) 1pt
readme.txt exists and is clear enough that I can get your project to compile 1pt
Your code reads in from the specified files and draws Bézier patches only of degree 3(1/2pt each) 1pt
Drawing is from a sane viewing angle and wireframes of patches also drawn (1/2pt each) 1pt
Your program correctly draws surfaces of revolution for each of the specified curve types listed above (2 pts for each curve type). 6pt
Total10pts